import { singleSign ,fusionreq} from '@/types/single-sign';
import apiClient from '../apiClient';

export enum singleSignApi {
  /**
   * sso配置
   */
  ssoSetting = '/openapi/v1/sso/setting',
  ssoSettingCheck = '/openapi/v1/sso/setting/check',
  oauth2Login = '/openapi/v1/oauth2/login',
  fusionapplist = '/openapi/v2/apps/list'
  
}

/**
 * 获取融合应用列表
 * @param 配置sso
 */
const getFusionapplist = (data:fusionreq) => apiClient.get({ url: singleSignApi.fusionapplist, params: data });


/**
 * 提交sso配置
 * @param 配置sso
 */
const postSsoSetting = (data:singleSign) => apiClient.post({ url: singleSignApi.ssoSetting, data });

/**
 * 获取sso配置
 * @param 配置sso
 */
const postSsoSettingCheck = (data:singleSign) => apiClient.get({ url: singleSignApi.ssoSettingCheck, params: data });

/**
 * 获取oauth2登录链接
 * @param 配置sso
 */
const oauth2Login = () => apiClient.get({ url: singleSignApi.oauth2Login });



export default {
  postSsoSetting,
  postSsoSettingCheck,
  oauth2Login,
  getFusionapplist
};
